package Game.Buff;

import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.geom.Vector2f;

/** Buff base class
 * @author Aikidos
 */
public class BuffBase {

	/** Buff Manager */
	private BuffManager _buffManager; 
	
	/** Number of steps */
	protected int _numOfSteps;
	
	/** Is unlimited? */
	protected boolean _isUnlimited = false;
	
	/** Buff icon */
	protected Image _icon = null;
	
	public BuffBase(BuffManager buffManager) throws SlickException {
		_buffManager = buffManager;
		
		_buffManager.addBuff(this);
	}
	
	/** Returns manager
	 * @return Buff manager
	 */
	public BuffManager getBuffManager() {
		return _buffManager;
	}
	
	/** Returns number of steps
	 * @return Number of steps
	 */
	public int getNumOfSteps() {
		return _numOfSteps;
	}
	
	/** Returns true if buff is unlimited by steps
	 * @return True if buff is unlimited by steps
	 */
	public boolean isUnlimited() {
		return _isUnlimited;
	}
	
	/** Set number of steps
	 * @param steps - Steps
	 */
	public void setNumOfSteps(int steps) {
		_numOfSteps = steps;
	}
	
	/** Sub some steps from number of steps */
	public void subSteps(int steps) {
		_numOfSteps -= steps;
	}
	
	/** Initialize buff */
	public void init() {
		
	}
	
	/** Shutdown buff 
	 * @throws SlickException */
	public void shutdown() throws SlickException {
		
	}
	
	/** Draw buff icon
	 * @param g - Slick2d graphics
	 * @param drawPos - Draw position
	 */
	public void drawIcon(Graphics g, Vector2f drawPos) {
		_icon.draw(drawPos.x, drawPos.y);
	}
	
	/** Buff step */
	public void step() {
		
	}
	
	/** Update 
	 * @throws SlickException */
	public void update(int delta) throws SlickException {
		
	}
	
}
